package com.itheima.edu.info.manager.day11;

import java.io.*;

public class ioLiu {
    public static void main(String[] args) throws IOException {
    /*    FileOutputStream fileOutputStream=new FileOutputStream("D://jinjie//实验//a.txt");
        fileOutputStream.write(50);
        fileOutputStream.close();*/
        FileInputStream fileInputStream = new FileInputStream("D://谷歌下载//ideaIU-2020.3.2.exe");
        FileOutputStream fileOutputStream = new FileOutputStream("D://jinjie//实验//ideaIU-2020.3.2.exe");
       /* int b;
       long l = System.currentTimeMillis();
        while ((b = fileInputStream.read()) != -1) {
            fileOutputStream.write(b);
        }
        fileInputStream.close();
        fileOutputStream.close();
        long g = System.currentTimeMillis();
        System.out.println(g-l);  */   //33713毫秒差



       /* BufferedInputStream bufferedInputStream=new BufferedInputStream(fileInputStream);
        BufferedOutputStream bufferedOutputStream=new BufferedOutputStream(fileOutputStream);
        int b;
        long l = System.currentTimeMillis();
        while ((b=bufferedInputStream.read())!=-1){
            bufferedOutputStream.write(b);
        }
        bufferedInputStream.close();
        bufferedOutputStream.close();
        long g = System.currentTimeMillis();
        System.out.println(g-l); */ //122毫秒差          13368



        BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
        int b;
        byte []arr=new byte[1024];
        long l = System.currentTimeMillis();
        while ((b=bufferedInputStream.read(arr))!=-1){
            bufferedOutputStream.write(arr,0,b);
        }
        bufferedInputStream.close();
        bufferedOutputStream.close();
        long g = System.currentTimeMillis();
        System.out.println(g-l);  //26毫秒差     891
        }
    }

